from urllib.request import *
from fake_useragent import *

# proxy代理

url = "http://httpbin.org/get"

headers = {
    "User-agent": UserAgent().chrome
}

request = Request(url, headers=headers)

# proxy_handler = ProxyHandler({"http": "username:password@ip:port"})
proxy_handler = ProxyHandler({"http": "175.42.122.249:9999"})

opener = build_opener(proxy_handler)

response = opener.open(request)

print(response.read().decode())
